package org.hardstone.domain.computer.resource;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import org.hardstone.domain.BaseCategory;
import org.hardstone.domain.BaseItemDomain;
import org.hardstone.domain.Status;

@Entity
@Table(name = "Network")
public class Network extends BaseItemDomain<Long> {

    @Column(name = "ipv4Adress")
    protected String ipv4Adress;              //ipv4 address

    @Column(name = "ipv6Adress")
    protected String ipv6Adress;              //ipv6 address

    @Column(name = "macAdress")
    protected String macAdress;               //physical address

    @Column(name = "maskCode")
    protected String maskCode;                //subnet mask

    @Column(name = "bandWidth")
    protected Long bandWidth;                 //network bandwidth

    @Column(name = "duration")
    protected Long duration;                  //time for alloc

    @Column(name = "dataTraffic")
    protected Long dataTraffic;              //used data traffic

    @Column(name = "protocol")
    protected String protocol;                //protocol for network


    public Network() {
        super();
        this.ipv4Adress = "0.0.0.0";
        this.ipv6Adress = "0:0:0:0:0:0:0:1";
        this.macAdress = "0:0:0:0:0:0:0:1";
        this.maskCode = "00:00:00:00:00:00";
        this.bandWidth = 0L;
        this.duration = 0L;
        this.dataTraffic = 0L;
        this.protocol = "None";
    }

    public Network(Long id, Long itemGroupId, String name, BaseCategory category, Long userId, Long userGroupId, int authority, String url, String description, Status status, String askDate, String modifyDate, String tags, String attribute) {
        super(id, itemGroupId, name, category, userId, userGroupId, authority, url, description, status, askDate, modifyDate, tags, attribute);
    }

    public Network(Long id, Long itemGroupId, String name, BaseCategory category, Long userId, Long userGroupId, int authority, String url, String description, Status status, String askDate, String modifyDate, String tags, String attribute, String ipv4Adress, String ipv6Adress, String macAdress, String maskCode, Long bandWidth, Long duration, Long dataTraffic, String protocol) {
        super(id, itemGroupId, name, category, userId, userGroupId, authority, url, description, status, askDate, modifyDate, tags, attribute);
        this.ipv4Adress = ipv4Adress;
        this.ipv6Adress = ipv6Adress;
        this.macAdress = macAdress;
        this.maskCode = maskCode;
        this.bandWidth = bandWidth;
        this.duration = duration;
        this.dataTraffic = dataTraffic;
        this.protocol = protocol;
    }

    public Network(String ipv4Adress, String ipv6Adress, String macAdress, String maskCode, Long bandWidth, Long duration, Long dataTraffic, String protocol) {
        this.ipv4Adress = ipv4Adress;
        this.ipv6Adress = ipv6Adress;
        this.macAdress = macAdress;
        this.maskCode = maskCode;
        this.bandWidth = bandWidth;
        this.duration = duration;
        this.dataTraffic = dataTraffic;
        this.protocol = protocol;
    }

    public String getIpv4Adress() {
        return ipv4Adress;
    }

    public void setIpv4Adress(String ipv4Adress) {
        this.ipv4Adress = ipv4Adress;
    }

    public String getIpv6Adress() {
        return ipv6Adress;
    }

    public void setIpv6Adress(String ipv6Adress) {
        this.ipv6Adress = ipv6Adress;
    }

    public String getMacAdress() {
        return macAdress;
    }

    public void setMacAdress(String macAdress) {
        this.macAdress = macAdress;
    }

    public String getMaskCode() {
        return maskCode;
    }

    public void setMaskCode(String maskCode) {
        this.maskCode = maskCode;
    }

    public Long getBandWidth() {
        return bandWidth;
    }

    public void setBandWidth(Long bandWidth) {
        this.bandWidth = bandWidth;
    }

    public Long getDuration() {
        return duration;
    }

    public void setDuration(Long duration) {
        this.duration = duration;
    }

    public Long getdataTraffic() {
        return dataTraffic;
    }

    public void setdataTraffic(Long dataTraffic) {
        this.dataTraffic = dataTraffic;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    @Override
    public String toString() {
        return "Network{" +
                "ipv4Adress='" + ipv4Adress + '\'' +
                ", ipv6Adress='" + ipv6Adress + '\'' +
                ", macAdress='" + macAdress + '\'' +
                ", maskCode='" + maskCode + '\'' +
                ", bandWidth=" + bandWidth +
                ", duration=" + duration +
                ", dataTraffic=" + dataTraffic +
                ", protocol='" + protocol + '\'' +
                ", id=" + id +
                ", itemGroupId=" + itemGroupId +
                ", name='" + name + '\'' +
                ", baseCategory=" + baseCategory +
                ", userId=" + userId +
                ", userGroupId=" + userGroupId +
                ", authority=" + authority +
                ", url='" + url + '\'' +
                ", description='" + description + '\'' +
                ", status=" + status +
                ", askDate='" + askDate + '\'' +
                ", modifyDate='" + modifyDate + '\'' +
                ", tags='" + tags + '\'' +
                ", attribute='" + attribute + '\'' +
                '}';
    }
}
